/****************************************************************************
**                                                                         **
**                                PSSDK Errors                             **
**            Copyright (c) 1997 - 2006 microOLAP Technologies LTD,        **
**                       Khalturin A.P., Naumov D.A.                       **
**                               Header File                               **
**                                                                         **
****************************************************************************/

//---------------------------------------------------------------------------
#ifndef __HN_ERR_H__
#define __HN_ERR_H__
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
// Common Errors
//---------------------------------------------------------------------------
#define HNERR_OK                     0  // No errors.
#define HNERR_WRONG_OS               1  // Packet Sniffer SDK does not support this OS version.
#define HNERR_CONFIG_NOT_DEFINED     2  // Network adapter configuration is not defined for 
// the HNAdapter object. See Handle property of the 
// HNAdapterConfig component.

#define HNERR_REG_OPEN_ERROR         3  // OS registry reading error.
#define HNERR_ADDR_ERR               4  // A memory access error.
#define HNERR_SIZE_ERR               5  // Wrong memory buffer size.
#define HNERR_COUNT_ERR              6  // Wrong number of packets.
#define HNERR_DRIVER_NOT_LOADED      7  // Packet Sniffer SDK internal driver loading error.
#define HNERR_CONTROL_NOT_OPENED     8  // Packet Sniffer SDK internal driver control device opening error.
#define HNERR_ADAPTER_NOT_OPENED     9  // Network adapter is not opened.
#define HNERR_ADAPTER_ALREADY_OPENED 10 // The network adapter has already been opened.
#define HNERR_ADAPTER_OPEN_ERR       11 // The network adapter opening error.
#define HNERR_ADAPTER_REQ_ERR        12 // An internal driver request error.
#define HNERR_ADAPTER_LIST_ERR       13 // An internal HNAdapterConfig components list error.
#define HNERR_ADAPTER_STATE_ERR      14 // Internal adapter status control initialization error.
#define HNERR_ADAPTER_THREAD_ERR     15 // Packet Sniffer SDK internal thread creating error.
#define HNERR_ADAPTER_THREAD_COUNT   16 // The number of threads for working with the network adapter must be from 1 to HNAdapter.MaxThreadCount.
#define HNERR_MEM_ALLOC_ERROR        17 // Memory allocation error.

#define HNERR_INVALID_HANDLE         18 // Invalid component handle.

#define HNERR_MEM_FREE_ERROR         19 // Memory free error.
#define HNERR_CREATE_SYNCOBJ_ERR     20 // Error of creating of the system synchronize object.
#define HNERR_THREAD_ERR             21 // Internal thread error.
#define HNERR_INCOMPATIBLE_VER       22 // Incompatible version.

//---------------------------------------------------------------------------
// Filter Errors
//---------------------------------------------------------------------------
#define HNERR_FLT_ERR                100
//---------------------------------------------------------------------------
#define HNERR_FLT_BAD_LEN            (HNERR_FLT_ERR +  0) // Instructions count in the filter program is wrong.
#define HNERR_NO_RET                 (HNERR_FLT_ERR +  1) // No return instruction at the end of filter. The code of the last BPF instruction must be equal to BPF_RET.
#define HNERR_WORK_MEM               (HNERR_FLT_ERR +  2) // The wrong values of instructions working with the memory of the virtual BPF machine (BPF_ST, BPF_STX, BPF_LD|BPF_MEM, BPF_LDX|BPF_MEM).
#define HNERR_JMP_TO_LONG            (HNERR_FLT_ERR +  3) // JUMP is too long.
#define HNERR_WRONG_INSTRUCTION      (HNERR_FLT_ERR +  4) // Invalid instruction code.
#define HNERR_WRONG_PARAMETER        (HNERR_FLT_ERR +  5) // Invalid instruction parameter.
#define HNERR_NO_PROGRAMM            (HNERR_FLT_ERR +  6) // No programm in the filter (the CommandCount field of the HN_BPF_PROGRAMM structure is equal to 0).
#define HNERR_LOAD_FILE_ERROR        (HNERR_FLT_ERR +  7) // No file, bad file (zero len).
#define HNERR_SAVE_FILE_ERROR        (HNERR_FLT_ERR +  8) // Cannot write to a file.
#define HNERR_BUFFER_TOO_SMALL       (HNERR_FLT_ERR +  9) // The memory buffer is too small.
#define HNERR_BUFFER_ERROR           (HNERR_FLT_ERR + 10) // Some error with buffer.

//---------------------------------------------------------------------------
// BPFCompiler Errors
//---------------------------------------------------------------------------
#define HNERR_BPF_ERR                200
//---------------------------------------------------------------------------
#define HNERR_BPF_ERROR              (HNERR_BPF_ERR +  0) // Syntax error.                         
#define HNERR_BPF_BAD_SYMBOL         (HNERR_BPF_ERR +  1) // Illegal character.
#define HNERR_BPF_UNTERM_COMMENT     (HNERR_BPF_ERR +  2) // Unclosed comment.                     
#define HNERR_BPF_UNTERM_STRING      (HNERR_BPF_ERR +  3) // Incomplete line.                      
#define HNERR_BPF_CANT_OPEN_FILE     (HNERR_BPF_ERR +  4) // File opening error.                     
#define HNERR_BPF_DUP_LABEL          (HNERR_BPF_ERR +  5) // Duplicated label.                    
#define HNERR_BPF_CONST_REDEFINE     (HNERR_BPF_ERR +  6) // Redefined constant.                     
#define HNERR_BPF_DEVIDE_BY_ZERO     (HNERR_BPF_ERR +  7) // Division by zero.                    
#define HNERR_BPF_BAD_MEM            (HNERR_BPF_ERR +  8) // Wrong address of an internal memory cell.
#define HNERR_BPF_BAD_CMD_FMT        (HNERR_BPF_ERR +  9) // Wrong instruction format.
#define HNERR_BPF_BAD_ID_LEN         (HNERR_BPF_ERR + 10) // Identifier is too long.               
#define HNERR_BPF_BAD_REG            (HNERR_BPF_ERR + 11) // Wrong register name.
#define HNERR_BPF_BAD_SIZE           (HNERR_BPF_ERR + 12) // Wrong operand size.                   
#define HNERR_BPF_UNK_LABEL          (HNERR_BPF_ERR + 13) // Unknown label.
#define HNERR_BPF_BACK_LABEL         (HNERR_BPF_ERR + 14) // Label points back.
#define HNERR_BPF_LONG_LABEL         (HNERR_BPF_ERR + 15) // Label points too far (must be not more than 255 instructions).                     
#define HNERR_BPF_STR_TOO_LONG       (HNERR_BPF_ERR + 16) // String is too long.
#define HNERR_BPF_UNKNOWN_ID         (HNERR_BPF_ERR + 17) // Unknown identyfier.
#define HNERR_BPF_COMPILE_ERR        (HNERR_BPF_ERR + 18) // Compile error.

//---------------------------------------------------------------------------
// FileAdapter Errors
//---------------------------------------------------------------------------
#define HNERR_FILEADAPTER_ERR        300
//---------------------------------------------------------------------------
#define HNERR_FILE_ERROR             (HNERR_FILEADAPTER_ERR + 0)  //
#define HNERR_OPEN_FILE_ERROR        (HNERR_FILEADAPTER_ERR + 1)  //
#define HNERR_READ_FILE_ERROR        (HNERR_FILEADAPTER_ERR + 2)  //
#define HNERR_WRITE_FILE_ERROR       (HNERR_FILEADAPTER_ERR + 3)  //
#define HNERR_BAD_FILE_FORMAT        (HNERR_FILEADAPTER_ERR + 4)  //
#define HNERR_FORMAT_VER_ERROR       (HNERR_FILEADAPTER_ERR + 5)  //
#define HNERR_BAD_MEDIUM_TYPE        (HNERR_FILEADAPTER_ERR + 6)  //
#define HNERR_BAD_PACKET_LEN         (HNERR_FILEADAPTER_ERR + 7)  //
#define HNERR_EOF                    (HNERR_FILEADAPTER_ERR + 8)  //
#define HNERR_BAD_FILE_NAME          (HNERR_FILEADAPTER_ERR + 9)  //
#define HNERR_QUEUE_ERROR            (HNERR_FILEADAPTER_ERR + 10) //
#define HNERR_UNKNOWN_FILE_FORMAT    (HNERR_FILEADAPTER_ERR + 11) //
#define HNERR_INCOMPATIBLE_MODE      (HNERR_FILEADAPTER_ERR + 12) //
#define HNERR_FILE_SIZE_LIMIT        (HNERR_FILEADAPTER_ERR + 13) //
#define HNERR_NO_HANDLER             (HNERR_FILEADAPTER_ERR + 14) //

//---------------------------------------------------------------------------
#endif // __HN_ERR_H__
//---------------------------------------------------------------------------
